#import "Color.h"

void colorRGBInit(ColorRGB *color)
{
	memset(color,0,sizeof(*color));
}

void colorRGBAInitRandom(ColorRGBA *color)
{
	color->r = rand()%100/100.0f;
	color->g = rand()%100/100.0f;
	color->b = rand()%100/100.0f;
	color->a = 1.0f;
}

void colorRGBASetComponent(ColorRGBA *color,int componentNum,float value)
{
	switch(componentNum)
	{
		case 0: // Red
			color->r = value;
			break;
		case 1: // Green
			color->g = value;
			break;
		case 2: // Blue
			color->b = value;
			break;
		case 3: // Alpha
			color->a = value;
			break;
	}
}

ColorRGB ColorRGBMake(float r,float g,float b)
{
	ColorRGB rgb = {r,g,b};
	return rgb;
}

ColorRGBA ColorRGBAMake(float r,float g,float b,float a)
{
	ColorRGBA rgba = {r,g,b,a};
	return rgba;
}